package hypeerweb;

public abstract class FindExtremePoint {
	protected Node capNode;

	/**
	 * @param capNode
	 */
	public FindExtremePoint(Node capNode) {
		this.capNode = capNode;
	}

	/**
	 * @return the extreme point in the HyPeerWeb
	 * @pre the capNode has been initialized correctly
	 * @post will return the extreme point in the HyPeerWeb
	 */
	public Node execute() {
		if (capNode.getFold().getWebId().getValue() == 0) {
			return findExtremePointInPerfectCube();
		} else {
			return findExtremePointInImperfectWeb();
		}
	}

	protected abstract Node findExtremePointInPerfectCube();

	protected abstract Node findExtremePointInImperfectWeb();
}
